﻿using System;
class RepeatNumInArr
{
    static int InputNumber()
    {
        while (true)
        {
            try
            {
                int number = int.Parse(Console.ReadLine());
                return number;
            }
            catch (Exception)
            {
                Console.Write("Please re-enter number: ");
            }
        }
    }
    static int HowManyTimes(int[] array, int number)
    {
        int counter = 0;
        for (int i = 0; i < array.Length; i++)
        {
            if (array[i] == number)
            {
                counter++;
            }
        }
        return counter;
    }
    static void Main()
    {
        int lenght = 0;
        int number = 0;
        int result = 0;
        Console.Write("please enter the lenght of arrays: ");
        lenght = InputNumber();
        int[] theArray = new int[lenght];
        for (int i = 0; i < lenght; i++)
        {
            Console.Write("Please enter the {0} element of the array: ", i);
            theArray[i] = InputNumber();
        }
        Console.Write("Please input check number: ");
        number = InputNumber();
        result = HowManyTimes(theArray, number);
        Console.WriteLine("the number {0} is found {1} times in current array", number,result);
        Console.ReadLine();
    }
}

